import axios from 'axios';

const service = axios.create({
  baseURL: '/api',
  timeout: 5000
});

service.interceptors.request.use(
  config => {
    // 请求拦截器
    return config;
  },
  error => {
    console.log(error);
    return Promise.reject(error);
  }
);

service.interceptors.response.use(
  response => {
    // 响应拦截器
    return response.data;
  },
  error => {
    console.log(error);
    return Promise.reject(error);
  }
);

export default service;